"""
数据库配置文件
包含 Tortoise ORM 的配置
"""
from .settings import settings

# Tortoise ORM 配置
TORTOISE_ORM = {
    'connections': {
        'default': {
            'engine': 'tortoise.backends.mysql',
            'credentials': {
                'host': settings.db_host,
                'port': settings.db_port,
                'user': settings.db_user,
                'password': settings.db_password,
                'database': settings.db_name,
                'minsize': 1,
                'maxsize': 10,
                'charset': 'utf8mb4',
                'echo': settings.debug,
            }
        }
    },
    'apps': {
        'models': {
            'models': ['app.models.user', 'app.models.role', 'app.models.policy', 'app.models.insurance_company',
                       'aerich.models', 'app.models.products'],
            'default_connection': 'default',
        }
    },
    'use_tz': False,
    'timezone': 'Asia/Shanghai'
}
